package org.dr.springmvcdemo.scheduleTask;



import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 定时任务，输出当前时间。
 * 注释原因：暂时没用避免浪费资源
 */
@Component
public class ScheduledTasks {

    // private static final Logger logger = LoggerFactory.getLogger(ScheduledTasks.class);
    //
    // private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
    //
    // @Scheduled(fixedRate = 5000)//每5秒执行一次fixedRate间隔时间
    // public void reportCurrentTime() {
    //     logger.info("This time is now {}", dateFormat.format(new Date()));
    // }
}
